package com.lgkj.zhm.controller;

import java.util.List;


import com.lgkj.zhm.util.domain.AjaxResult;
import com.lgkj.zhm.util.page.TableDataInfo;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.lgkj.zhm.domain.DeviceOnline;
import com.lgkj.zhm.service.IDeviceOnlineService;

import javax.annotation.Resource;


/**
 * 设备在线情况Controller
 *
 * @author 代星登
 * @date 2021-02-22
 */
@RestController

public class DeviceOnlineController extends BaseController
{
    @Resource
    private IDeviceOnlineService deviceOnlineService;

    /**
     * 查询设备在线情况列表
     */

    @GetMapping("/deviceOnline/list")
    public TableDataInfo list(DeviceOnline deviceOnline)
    {
        startPage();
        List<DeviceOnline> list = deviceOnlineService.selectDeviceOnlineList(deviceOnline);
        return getDataTable(list);
    }





    @RequestMapping("/test")
    public  void list()
    {

        System.out.println("控制层进来了");
      /*  startPage();
        List<DeviceOnline> list = deviceOnlineService.selectDeviceOnlineList(deviceOnline);
        return list;*/
    }


    /*
    * 过滤浏览器发送的   http://localhost:8090/favicon.ico  请求
    * */
    @RequestMapping("/favicon.ico")
    public  void list1()
    {
       // System.out.println("控制层==进来了");


        return;
    }

/*    *//**
     * 导出设备在线情况列表
     *//*

    @GetMapping("/export")
    public AjaxResult export(DeviceOnline deviceOnline)
    {
        List<DeviceOnline> list = deviceOnlineService.selectDeviceOnlineList(deviceOnline);
        ExcelUtil<DeviceOnline> util = new ExcelUtil<DeviceOnline>(DeviceOnline.class);
        return util.exportExcel(list, "Online");
    }*/

    /**
     * 获取设备在线情况详细信息"/deviceOnline
     */

    @GetMapping(value = "/deviceOnline/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {

        return AjaxResult.success(deviceOnlineService.selectDeviceOnlineById(id));

    }

    /**
     * 新增设备在线情况
     */


    @PostMapping ("/deviceOnline/add")
    public AjaxResult add(@RequestBody DeviceOnline deviceOnline)
    {
        return toAjax(deviceOnlineService.insertDeviceOnline(deviceOnline));
    }

    /**
     * 修改设备在线情况
     */

    @PostMapping ("/deviceOnline/edit")
    public AjaxResult edit(@RequestBody DeviceOnline deviceOnline)
    {
        return toAjax(deviceOnlineService.updateDeviceOnline(deviceOnline));
    }

    /**
     * 删除设备在线情况
     */

	@DeleteMapping("/deviceOnline/del/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(deviceOnlineService.deleteDeviceOnlineByIds(ids));
    }
}
